<?php
/**
 * Created by PhpStorm.
 * User: 李一瑶
 * Date: 2019/1/10
 * Time: 11:43
 */

namespace App\Http\Repository;

use App\Http\Model\Log;
use App\Http\Service\LogInterface;


class LogRepository implements LogInterface
{
    public $log;

    public function __construct(Log $log)
    {
        $this->log = $log;
    }

   public function index(array $type)
   {
       $count = $this->log->where('type','=',$type['type'])->count();
       $data = $this->log->where('type','=',$type['type'])
           ->skip(($type['pageNum'] - 1) * $type['pageSize'])
           ->take($type['pageSize'])
           ->orderBy('time', 'desc')
           ->get()->toArray();
       return response()->json(['code' => 200,'data' => ['data' => $data,'count' => $count], 'message' => '获取操作日志列表成功']);
   }
}